Part Number Hot Search : 
BAT43 1N416F 0100P SNC20AS BAT43 E2505H43 AUY27 74AC1
Product Description
Full Text Search
 

To Download AN1096 Datasheet File

  If you can't view the Datasheet, Please click here to try to view without PDF Reader .  
 
 


  Datasheet File OCR Text:
  ? 2007 microchip technology inc. ds01096b-page 1 AN1096 introduction the 25xxx series serial eeproms from microchip technology are spi compatible and have maximum clock frequencies ranging from 3 mhz to 20 mhz. many times when designing an application which utilizes a serial eeprom device, it may be beneficial to use a microcontroller which does not feature a dedicated protocol-specific serial port. this can be due to several possible reasons, including size restrictions or costs. in these instances, it is required of the designer to write software routines capable of generating the proper signals for communicating with the eeprom device. this application note provides assistance and source code to ease the design process of interfacing a microchip dspic33f digital signal controller to a microchip spi serial eeprom, without the use of a hardware serial port. figure 1 describes the hardware schematic for the interface between microchip?s 25xxx series devices and the dspic33f dsc or pic24f pic ? microcontrol- ler. the schematic shows the connections necessary between the dsc or pic mcu and the serial eeprom as tested, and the software was written assuming these connections. the wp and hold pins are tied to v cc through resistors, because the write-protect and hold features are not used in the examples provided. figure 1: circuit for dspic33f256gp710, pic24fj128ga010 and 25xxx series devices author: martin kvasnicka microchip technology inc. cs so wp vss vcc hold sck si 1 2 3 4 8 7 6 5 vcc 25xxx note: cs , wp and hold pins should all have pull-up resistors (~10k-ohms). 100 pin tqfp dspic33fj256gp710 u1tx/rf3 u1rx/rf2 sdo1/rf8 sdi1/rf7 sck1/int0/rf6 sda1/rg3 v ss v dd u1cts/cn20/rd14 u1rts/cn21/rd15 u2rx/cn17/rf4 u2tx/cn18/rf5 pic24fj128ga010 using the c30 compiler to interface spi serial eeproms with dspic33f and pic24f
AN1096 ds01096b-page 2 ? 2007 microchip technology inc. firmware description the purpose of the program is to show individual features of the spi protocol and give code samples of the instructions and addressing schemes so that the basic building blocks of a program can be shown. the firmware performs the following operations: ? low-density byte write ? low-density byte read ? low-density page write ? low-density sequential read ? write enable ? wip polling in addition, the following operations are available but not explicitly illustrated: ? high-density byte write ? high-density byte read ? high-density page write ? high-density sequential read ? write disable ? read status register ? write status register the low-density routines are intended for use with the 4k and smaller density devices that use only one byte for addressing. the high-density routines are intended for use with 8k and higher density devices that use two bytes for addressing. this program also exhibits the wip polling feature for detecting the completion of write cycles after the byte write and page write operations. read operations are located directly after each write operation, thus allowing for verification that the data was properly written. no method of displaying the input data is provided, but a seeval ? 32 evaluation system, an oscilloscope, or a microchip mplab ? icd 2 could be used. the low-density code was tested using the 25lc040a serial eeprom. this device features 512 x 8 (4 kbit) of memory and 16-byte pages. the high- density code was tested using the 25lc256 serial eeprom. this device features 32k x 8 (256 kbit) of memory and 64-byte pages. only the low-density operations are illustrated in this application note. oscilloscope screen shots are labeled for ease in read- ing. the data sheet versions of the waveforms are shown below the oscilloscope screen shots. all timings are designed to meet the data sheet specs, and an 8 mhz crystal oscillator is used to clock the dspic33f dsc or pic24f microcontroller. if a different clock is used, the code may need to be modified to avoid violat- ing timing specs. all values represented in this applica- tion note are decimal values unless otherwise noted.
? 2007 microchip technology inc. ds01096b-page 3 AN1096 write enable figure 2 shows an example of the write enable command. chip select is brought low (active) and the opcode (0x06) is shifted out. the write enable com- mand must be given in order to set the wel bit before a write is attempted to either the array or the status register. the wel bit can be cleared by issuing a write disable command (wrdi) and is also automatically reset if the device is powered down or if a write cycle is completed. figure 2: write enable (wren) sck 0234567 1 si high-impedance so cs 01 0000 0 1
AN1096 ds01096b-page 4 ? 2007 microchip technology inc. read status register to check for wel bit figure 3 shows an example of the read status register command to check for the wel bit. this bit must be set before a write is attempted to either the status register or the array. it is good programming practice to check for the bit to be set before attempting the write. once again the device is selected and the opcode (0x05) is sent. the status register is shifted out on the serial out pin. a value of 0x02 shows that the wel bit in the status register has been set. the device is now ready to do a write to either the status register or the array. figure 3: read status register to check for wel bit (rdsr) so si cs 91011 12131415 11 0 0 0 0 00 7654 2 10 instruction data from status register high-impedance sck 0 234567 18 3
? 2007 microchip technology inc. ds01096b-page 5 AN1096 byte write command (opcode, address and data) figure 4 shows an example of the write command. first, the device is selected by bringing chip select low (active). in this example, the most significant bit of the address is a ? 1 ?. this bit is embedded in the opcode (0x02 for a write command), and so the value, 0x0a, is sent. the low address byte (0x33) is sent next. finally, the data is clocked in, in this case, 0xcc. once chip select is toggled at the end of this command, the inter- nal write cycle is initiated. after the write cycle has begun, the wip bit in the status register can be polled to check when the write finishes. if polling is not used, a delay (~5ms) needs to be added to ensure the write has finished. this code uses wip polling. a page write can be accomplished by continuing to send data bytes to the device without toggling cs . up to 16 bytes can be written to the 25lc040a before a write cycle is needed. once cs is brought high after the data bytes have been transmitted, then the write cycle timer will begin and normal polling can be initiated. the page write function provided in the firmware is used to program 16 bytes of data, starting at address 0x150. because page writes cannot cross page bound- aries, care must be taken to avoid having data wrap around to the beginning of the page and overwrite existing data. figure 4: byte write command, address and data so si sck cs 0 23456789101112131415161718192021 22 1 00 a8 0 0 0 0 a7 a6 a5 a4 a1 a0 76543210 instruction low address byte data byte high-impedance 23 a3 a2 1 t wc
AN1096 ds01096b-page 6 ? 2007 microchip technology inc. data polling (rdsr ? check for wip set) after a valid write command is given, the status register can be read to check if the internal write cycle has been initiated, and it can continuously be monitored to look for the end of the write cycle. in this case, the device is selected and the rdsr opcode (0x05) is sent. the status register is then shifted out on the serial out (so) pin resulting in a value of 0x03. figure 5 shows that both the wel bit (bit 1) and the wip bit (bit 0) are set, meaning that the write cycle is in progress. figure 5: data polling (read status register to check wip bit) so si cs 91011 12131415 11 0 0 0 0 00 7654 2 10 instruction data from status register high-impedance sck 0 234567 1 8 3
? 2007 microchip technology inc. ds01096b-page 7 AN1096 data polling finished (rdsr ? wip bit cleared) the firmware remains in a continuous loop and the wip status is evaluated until the bit is cleared. figure 6 shows the read status register command followed by a value of 0x00 being shifted out on the serial out (so) pin. this indicates that the write cycle has finished and the device is now ready for additional commands. the wel bit is also cleared at the end of a write cycle, which serves as additional protection against unwanted writes. figure 6: data polling finished (rdsr ? wip and wel bits cleared) so si cs 91011 12131415 11 0 0 0 0 00 7654 2 10 instruction data from status register high-impedance sck 0 234567 18 3
AN1096 ds01096b-page 8 ? 2007 microchip technology inc. read command (opcode, address and data) figure 7 shows an example of the read command. for this, the device is selected. as with the write command, the most significant bit of the address is a ? 1 ?. there- fore, when combined with the read opcode (0x03), the value 0x0b is sent. the low address byte, 0x33, is then sent. finally the data, 0xcc in this case, is clocked out on the serial out (so) pin. in order to perform a sequential read, more clocks need to be generated. it is possible to read the entire chip by continuing to clock the device. once the end of the array is reached, the data will wrap to the beginning of the array (address 0x000) and keep reading out until cs is deselected or the device is no longer being clocked. figure 7: read command, address and data so si sck cs 0 23456789101112131415161718192021 22 1 01 a8 0 0 0 01 a7 a6 a5 a4 a1 a0 76543210 instruction low address byte data out high-impedance 23 a3 a2 don?t care
? 2007 microchip technology inc. ds01096b-page 9 AN1096 changing processors this application note code was written to simplify changing between processors. there are, however, a couple of steps that need to be taken in order to do this. this application note was tested with two specific processors, the dspic33fj256gp710 and the pic24fj128ga010. if you are going to use processors that are different from these two, please consult the device-specific data sheet to check for any other poten- tial issues when using this code. as mentioned previ- ously, the explorer 16 development board was used for this application note with the connections shown in figure 1. in order to change between these processors there are four steps: 1. the current processor module currently on the explorer 16 board must be physically replaced with the processor module desired. be sure to disconnect power during this procedure. 2. the #define statements on lines 42 and 43 in the AN1096.h file must be commented in/out for the desired processor. 3. the new processor needs to be selected in the mplab ide by going to configure>select device... 4. the linker file needs to be added/removed for the desired processor. if this is not done, it will not prevent the code from compiling but may create some undesired warnings from the compiler. conclusion these are some of the basic features of spi communi- cations on one of microchip?s dspic33f or pic24f devices without the use of a hardware serial port. the code is highly portable and can be used on many dspic ? dscs with very minor modifications. using the code provided, designers can begin to build their own spi libraries to be as simple or as complex as needed. the code was tested on microchip?s explorer 16 demonstration board with the connections shown in figure 1.
AN1096 ds01096b-page 10 ? 2007 microchip technology inc. notes:
? 2007 microchip technology inc. ds01096b-page 11 information contained in this publication regarding device applications and the like is provided only for your convenience and may be superseded by updates. it is your responsibility to ensure that your application meets with your specifications. microchip makes no representations or warranties of any kind whether express or implied, written or oral, statutory or otherwise, related to the information, including but not limited to its condition, quality, performance, merchantability or fitness for purpose . microchip disclaims all liability arising from this information and its use. use of microchip devices in life support and/or safety applications is entirely at the buyer?s risk, and the buyer agrees to defend, indemnify and hold harmless microchip from any and all damages, claims, suits, or expenses resulting from such use. no licenses are conveyed, implicitly or otherwise, under any microchip intellectual property rights. trademarks the microchip name and logo, the microchip logo, accuron, dspic, k ee l oq , k ee l oq logo, micro id , mplab, pic, picmicro, picstart, pro mate, rfpic and smartshunt are registered trademarks of microchip technology incorporated in the u.s.a. and other countries. amplab, filterlab, linear active thermistor, migratable memory, mxdev, mxlab, seeval, smartsensor and the embedded control solutions company are registered trademarks of microchip tec hnology incorporated in the u.s.a. analog-for-the-digital age, appl ication maestro, codeguard, dspicdem, dspicdem.net, dspicworks, dsspeak, ecan, economonitor, fansense, flexrom, fuzzylab, in-circuit serial programming, icsp, icepic, mindi, miwi, mpasm, mplab certified logo, mplib, mplink, pickit, picdem, picdem.net, piclab, pictail, powercal, powerinfo, powermate, powertool, real ice, rflab, select mode, smart serial, smarttel, total endurance, uni/o, wiperlock and zena are tr ademarks of microchip technology incorporated in the u.s.a. and other countries. sqtp is a service mark of microchip technology incorporated in the u.s.a. all other trademarks mentioned herein are property of their respective companies. ? 2007, microchip technology incorporated, printed in the u.s.a., all rights reserved. printed on recycled paper. note the following details of the code protection feature on microchip devices: ? microchip products meet the specification cont ained in their particular microchip data sheet. ? microchip believes that its family of products is one of the most secure families of its kind on the market today, when used i n the intended manner and under normal conditions. ? there are dishonest and possibly illegal methods used to breach the code protection feature. all of these methods, to our knowledge, require using the microchip produc ts in a manner outside the operating specif ications contained in microchip?s data sheets. most likely, the person doing so is engaged in theft of intellectual property. ? microchip is willing to work with the customer who is concerned about the integrity of their code. ? neither microchip nor any other semiconduc tor manufacturer can guarantee the security of their code. code protection does not mean that we are guaranteeing the product as ?unbreakable.? code protection is constantly evolving. we at microchip are co mmitted to continuously improvin g the code protection features of our products. attempts to break microchip?s code protection feature may be a violation of the digital millennium copyright act. if such acts allow unauthorized access to your software or other copyrighted work, you may have a right to sue for relief under that act. microchip received iso/ts-16949:2002 certification for its worldwide headquarters, design and wafer fabrication facilities in chandler and tempe, arizona; gresham, oregon and design centers in california and india. the company?s quality system processes and procedures are for its pic ? mcus and dspic ? dscs, k ee l oq ? code hopping devices, serial eeproms, microperipherals, nonvolatile memory and analog products. in addition, microchip?s quality system for the design and manufacture of development systems is iso 9001:2000 certified.
ds01096b-page 12 ? 2007 microchip technology inc. americas corporate office 2355 west chandler blvd. chandler, az 85224-6199 tel: 480-792-7200 fax: 480-792-7277 technical support: http://support.microchip.com web address: www.microchip.com atlanta duluth, ga tel: 678-957-9614 fax: 678-957-1455 boston westborough, ma tel: 774-760-0087 fax: 774-760-0088 chicago itasca, il tel: 630-285-0071 fax: 630-285-0075 dallas addison, tx tel: 972-818-7423 fax: 972-818-2924 detroit farmington hills, mi tel: 248-538-2250 fax: 248-538-2260 kokomo kokomo, in tel: 765-864-8360 fax: 765-864-8387 los angeles mission viejo, ca tel: 949-462-9523 fax: 949-462-9608 santa clara santa clara, ca tel: 408-961-6444 fax: 408-961-6445 toronto mississauga, ontario, canada tel: 905-673-0699 fax: 905-673-6509 asia/pacific asia pacific office suites 3707-14, 37th floor tower 6, the gateway harbour city, kowloon hong kong tel: 852-2401-1200 fax: 852-2401-3431 australia - sydney tel: 61-2-9868-6733 fax: 61-2-9868-6755 china - beijing tel: 86-10-8528-2100 fax: 86-10-8528-2104 china - chengdu tel: 86-28-8665-5511 fax: 86-28-8665-7889 china - fuzhou tel: 86-591-8750-3506 fax: 86-591-8750-3521 china - hong kong sar tel: 852-2401-1200 fax: 852-2401-3431 china - nanjing tel: 86-25-8473-2460 fax: 86-25-8473-2470 china - qingdao tel: 86-532-8502-7355 fax: 86-532-8502-7205 china - shanghai tel: 86-21-5407-5533 fax: 86-21-5407-5066 china - shenyang tel: 86-24-2334-2829 fax: 86-24-2334-2393 china - shenzhen tel: 86-755-8203-2660 fax: 86-755-8203-1760 china - shunde tel: 86-757-2839-5507 fax: 86-757-2839-5571 china - wuhan tel: 86-27-5980-5300 fax: 86-27-5980-5118 china - xian tel: 86-29-8833-7252 fax: 86-29-8833-7256 asia/pacific india - bangalore tel: 91-80-4182-8400 fax: 91-80-4182-8422 india - new delhi tel: 91-11-4160-8631 fax: 91-11-4160-8632 india - pune tel: 91-20-2566-1512 fax: 91-20-2566-1513 japan - yokohama tel: 81-45-471- 6166 fax: 81-45-471-6122 korea - daegu tel: 82-53-744-4301 fax: 82-53-744-4302 korea - seoul tel: 82-2-554-7200 fax: 82-2-558-5932 or 82-2-558-5934 malaysia - kuala lumpur tel: 60-3-6201-9857 fax: 60-3-6201-9859 malaysia - penang tel: 60-4-227-8870 fax: 60-4-227-4068 philippines - manila tel: 63-2-634-9065 fax: 63-2-634-9069 singapore tel: 65-6334-8870 fax: 65-6334-8850 taiwan - hsin chu tel: 886-3-572-9526 fax: 886-3-572-6459 taiwan - kaohsiung tel: 886-7-536-4818 fax: 886-7-536-4803 taiwan - taipei tel: 886-2-2500-6610 fax: 886-2-2508-0102 thailand - bangkok tel: 66-2-694-1351 fax: 66-2-694-1350 europe austria - wels tel: 43-7242-2244-39 fax: 43-7242-2244-393 denmark - copenhagen tel: 45-4450-2828 fax: 45-4485-2829 france - paris tel: 33-1-69-53-63-20 fax: 33-1-69-30-90-79 germany - munich tel: 49-89-627-144-0 fax: 49-89-627-144-44 italy - milan tel: 39-0331-742611 fax: 39-0331-466781 netherlands - drunen tel: 31-416-690399 fax: 31-416-690340 spain - madrid tel: 34-91-708-08-90 fax: 34-91-708-08-91 uk - wokingham tel: 44-118-921-5869 fax: 44-118-921-5820 w orldwide s ales and s ervice 10/05/07


▲Up To Search▲   

 
Price & Availability of AN1096

All Rights Reserved © IC-ON-LINE 2003 - 2022  

[Add Bookmark] [Contact Us] [Link exchange] [Privacy policy]
Mirror Sites :  [www.datasheet.hk]   [www.maxim4u.com]  [www.ic-on-line.cn] [www.ic-on-line.com] [www.ic-on-line.net] [www.alldatasheet.com.cn] [www.gdcy.com]  [www.gdcy.net]


 . . . . .
  We use cookies to deliver the best possible web experience and assist with our advertising efforts. By continuing to use this site, you consent to the use of cookies. For more information on cookies, please take a look at our Privacy Policy. X